﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ControlBaoCaoKhuyenMai.ascx.cs" Inherits="WebUserControl_ControlBaoCaoKhuyenMai" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register src="uscMsgBox.ascx" tagname="uscMsgBox" tagprefix="uc2" %>
<%--<%@ Register assembly="DevExpress.Web.ASPxPivotGrid.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPivotGrid" tagprefix="dxwpg" %>
--%>
<%@ Register assembly="DevExpress.Web.ASPxPivotGrid.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPivotGrid" tagprefix="dxwpg" %>
<%@ Register assembly="DevExpress.Web.ASPxPivotGrid.v9.2.Export, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.XtraPivotGrid.Web" tagprefix="dxpgw" %>


<link rel="stylesheet" href='<%=ResolveUrl("~/LayoutCss/datePicker.css")%>' type="text/css" />
<link rel="stylesheet" href='<%=ResolveUrl("~/LayoutCss/K_BaoCaoFormLayout.css")%>' type="text/css" />


<script type="text/javascript">
     function pageLoad() {
     
      $(function()
        {
	            $("#<%= txtFromDate.ClientID %>").datePicker(
	                {
	                    clickInput:true,
			            startDate: '01/01/1970'
	                }
	                );
        });
	            
	            $("#<%= txtFromDate.ClientID %>").bind(
		            'dpClosed',function(e, selectedDates)
		                        {
			                        var d = selectedDates[0];
			                        if (d) {
				                            d = new Date(d);
				                            $("#<%= txtToDate.ClientID %>").dpSetStartDate(d.addDays(0).asString());
			                                }
		                        }
	                    );
	                    
	     $(function()
        {
	            $("#<%= txtToDate.ClientID %>").datePicker(
	                {
	                    clickInput:true
			           
	                }
	                );
        });
	
	          $("#<%= txtToDate.ClientID %>").bind(
		           'dpClosed',function(e, selectedDates)
		                        {
			                        var d = selectedDates[0];
			                        if (d) {
				                            d = new Date(d);
				                            $("#<%= txtFromDate.ClientID %>").dpSetEndDate(d.addDays(0).asString());
			                                }
		                        }
	            );
	            
       $("#<%= Button1.ClientID %>").click(function() { 
        $.blockUI({
             message: '<h1>Xin vui lòng chờ xử lý</h1>', 
            css: { 
            border: 'none', 
            padding: '15px', 
            backgroundColor: '#f00', 
            opacity: .5, 
            color: '#fff' 
        } }); 
        }); 
        
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
                function EndRequestHandler(sender, args) {
                        $.unblockUI();
                }
        }  
   
</script>  


<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
     <fieldset>
    <legend>Báo cáo khuyến mãi</legend>
    <div class="fm-req">
      <label for="txtFromDate">Từ ngày:</label>
      <asp:TextBox ID="txtFromDate" runat="server">
                    </asp:TextBox>
      </div>
      <div class="fm-req">
      <label for="txtFromDate">Đến ngày:</label>
      <asp:TextBox ID="txtToDate" runat="server"></asp:TextBox>
      </div>
      </fieldset>
      
        <div>
                    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" 
                        Text="Xem báo cáo" />
               </div>
        <br />
         <dxwpg:ASPxPivotGrid ID="ASPxPivotGrid1" runat="server" 
            CustomizationFieldsVisible="True" CustomizationFieldsLeft="500" 
            CustomizationFieldsTop="50">
            <Fields>
                <dxwpg:PivotGridField ID="field" Area="RowArea" AreaIndex="1" 
                    Caption="Nhãn hiệu" FieldName="InclassName">
                </dxwpg:PivotGridField>
                <dxwpg:PivotGridField ID="field1" Area="RowArea" AreaIndex="2" 
                    Caption="Nhóm hàng" FieldName="ProductName">
                </dxwpg:PivotGridField>
                <dxwpg:PivotGridField ID="field2" Area="RowArea" AreaIndex="3" 
                    Caption="Ngành hàng" FieldName="CommodName">
                </dxwpg:PivotGridField>
                <dxwpg:PivotGridField ID="field3" Area="RowArea" AreaIndex="4" 
                    Caption="Tên hàng" FieldName="ItemName">
                </dxwpg:PivotGridField>
                <dxwpg:PivotGridField ID="field4" Area="RowArea" AreaIndex="5" 
                    Caption="Trung tâm phân phối" FieldName="SiteCode">
                </dxwpg:PivotGridField>
                <dxwpg:PivotGridField ID="field5" Area="RowArea" AreaIndex="6" 
                    Caption="Mã hàng" FieldName="SkuCode">
                </dxwpg:PivotGridField>
                <dxwpg:PivotGridField ID="field6" Area="RowArea" AreaIndex="0" 
                    Caption="Mã nhân viên bán hàng" FieldName="salespkey">
                </dxwpg:PivotGridField>
                <dxwpg:PivotGridField ID="field7" Area="ColumnArea" AreaIndex="0" 
                    Caption="Ngày(phát sinh doanh số)" FieldName="OffDate">
                </dxwpg:PivotGridField>
                <dxwpg:PivotGridField ID="field8" Area="DataArea" AreaIndex="0" 
                    Caption="Doanh số theo lượng" FieldName="OffQty">
                </dxwpg:PivotGridField>
                <dxwpg:PivotGridField ID="field9" Area="DataArea" AreaIndex="1" 
                    Caption="Doanh số theo tiền" FieldName="OffAmt">
                </dxwpg:PivotGridField>
                <dxwpg:PivotGridField ID="field10" Area="RowArea" AreaIndex="7" 
                    Caption="Tên nhân viên bán hàng" FieldName="salespname">
                </dxwpg:PivotGridField>
                <dxwpg:PivotGridField ID="field11" Area="RowArea" AreaIndex="8" Caption="Tỉnh" 
                    FieldName="mprovince">
                </dxwpg:PivotGridField>
                <dxwpg:PivotGridField ID="field12" Area="RowArea" AreaIndex="9" 
                    Caption="Khu vực" FieldName="mTown">
                </dxwpg:PivotGridField>
                <dxwpg:PivotGridField ID="field13" Area="RowArea" AreaIndex="10" 
                    Caption="ADNCode" FieldName="mADNCode">
                </dxwpg:PivotGridField>
                <dxwpg:PivotGridField ID="field14" Area="RowArea" AreaIndex="11" 
                    Caption="Cấp bậc" FieldName="mHightLevel">
                </dxwpg:PivotGridField>
            </Fields>
        </dxwpg:ASPxPivotGrid>
        <br />
        <br />
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="Data Source=SMART-7DC519368\SQLEXPRESS;Initial Catalog=CosmeticCenter;Integrated Security=True" 
            ProviderName="System.Data.SqlClient" SelectCommand="get_data_from_table" 
            SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:Parameter Name="TableName" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
        <br />
        <uc2:uscMsgBox ID="uscMsgBox1" runat="server" />
       
    </ContentTemplate>
</asp:UpdatePanel>


